﻿using System;
using System.Windows;
using System.IO;
using Microsoft.Win32;

namespace epiMediaPlayer
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            media.Play();
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            media.Pause();
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            media.Stop();
        }

        private void slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            media.Volume = sound.Value;
        }

        private void open_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == true)
            {
                openFileDialog1.Multiselect = false;
                media.Source = new Uri(openFileDialog1.FileName);
            }
        }
    }
}
